﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Danhsachlop : System.Web.UI.Page
{
    BUS_Children objC = new BUS_Children();
    BUS_TeacherClass objT = new BUS_TeacherClass();
    BUS_Class objCl = new BUS_Class();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["TeacherLogin"] != null)
        {
            Hienthi();
            Page.Title = "Danh sách học sinh";
        }
        else Response.Redirect("dangnhap.aspx?gv=1");
        
    }
    public void Hienthi()
    {
        string teacherid = Session["username"].ToString();
        var dataT = objT.TeacherClass_getAllByTeacherid(teacherid);
        if (dataT.Rows.Count > 0)
        {
            string classid = dataT.Rows[0]["classid"].ToString();
            var dataC = objCl.Class_getAllByClassid(classid);
            lbclassname.Text = "Lớp: " + dataC.Rows[0]["name"].ToString();
            rptdshs.DataSource = objC.Children_GetChildrenJoinChildrenclassById(classid);
            rptdshs.DataBind();
        }
        else lbclassname.Text = "Chưa được phân công dạy";
    }
}